package jsyf.oa.web.filter;

import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * All rights Reserved, Designed By www.yingfeng365.com
 *
 * @version V1.0.0
 * @projectName: shop
 * @title: MyExceptionHandler
 * @package jsyf.sys.web.filter
 * @description: 用于controller异常拦击做处理的
 * @author: 张伟
 * @date: 2017/12/9 23:04
 * @copyright: 2017 http://www.yingfeng365.com
 * 注意：本内容仅限于 江苏灜沣信息科技有限公司，禁止外泄以及用于其他的商业
 */
public class MyExceptionHandler implements HandlerExceptionResolver {
    @Override
    public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
        try {
            ResponseUtils.putJsonResponse(response,BaseUtils.errorrRespond("服务器内部异常！"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
